package com.guoyw.dubbo.bootservice.serviceImpl;

import com.guoyw.dubbo.member.entity.User;
import com.guoyw.dubbo.member.mapper.UserMapper;
import com.guoyw.dubbo.member.service.UserService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.management.ManagementFactory;

/**
 * author: guoyw
 * create: 2020-09-11 17:23
 **/
@Service
@Component
public class UserServiceImpl implements UserService{
  
  @Autowired
  UserMapper userMapper;
  
  @Override
  public User getUser(Integer id){
    User user = new User();
    user.setId(id);
    user.setName("guoyw:" + ManagementFactory.getRuntimeMXBean().getName());
    user.setSex("man");
    return user;
  }
  
  @Override
  public int insterUser(User user){
  
    user.setName("guoyw:" + ManagementFactory.getRuntimeMXBean().getName());
    user.setSex("man");
    return userMapper.insert(user);
  }
}
